//
//  ViewController.swift
//  TestCycleScrollView
//
//  Created by alyadan on 2017/3/11.
//  Copyright © 2017年 alyadan. All rights reserved.
//

import UIKit
import YDCycleScrollView
import SnapKit

class NormalScrollController: UIViewController {
    
    let cycleScrollModel = YDCycleScrollViewModel(parentViewModel: nil, startIndex: 0)
    var cycleScrollView: YDCycleScrollView!
    override func viewDidLoad() {
        super.viewDidLoad()
        
//        self.automaticallyAdjustsScrollViewInsets = true
        self.edgesForExtendedLayout = []
        
        let v1 = UIView()
        let v2 = UIView()
        
        let views = [v1, v2]
        let _ = views.map { (x) in
            x.backgroundColor = UIColor.init(HEXValue: Int(arc4random()))
        }
        
        //        self.cycleScrollModel.showPageController = true
        self.cycleScrollModel.yd_contentViews = views
        self.cycleScrollModel.timerInterval = 1
        cycleScrollView = YDCycleScrollView(viewModel: self.cycleScrollModel)
        
        self.view.addSubview(self.cycleScrollView)
        
        self.cycleScrollView.snp.makeConstraints { [unowned self] (ConstraintMaker) in
//            ConstraintMaker.top.equalTo(self.topLayoutGuide.snp.bottom)
            ConstraintMaker.left.bottom.top.right.equalTo(self.view)
        }
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        print(self.cycleScrollView.scrollView.contentSize)
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
}


